home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / www / library / implemen / htaccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  7.0 KB  |  293 lines

  1. /*                                                      HTAccess:  Access manager  for libwww
  2.                                       ACCESS MANAGER
  3.                                              
  4.    This module keeps a list of valid protocol (naming scheme) specifiers with associated
  5.    access code.  It allows documents to be loaded given various combinations of
  6.    parameters. New access protocols may be registered at any time.
  7.    
  8.    Part of the libwww library .
  9.    
  10.  */
  11. #ifndef HTACCESS_H
  12. #define HTACCESS_H
  13.  
  14. /*      Definition uses:
  15. */
  16. #include "HTUtils.h"
  17. #include "tcp.h"
  18. #include "HTAnchor.h"
  19. #include "HTFormat.h"
  20.  
  21. #ifdef SHORT_NAMES
  22. #define HTClientHost            HTClHost
  23. #define HTSearchAbsolute        HTSeAbso
  24. #define HTOutputStream          HTOuStre
  25. #define HTOutputFormat          HTOuForm
  26. #endif
  27.  
  28. /*      Return codes from load routines:
  29. **
  30. **      These codes may be returned by the protocol modules,
  31. **      and by the HTLoad routines.
  32. **      In general, positive codes are OK and negative ones are bad.
  33. */
  34.  
  35. #define HT_NO_DATA -9999        /* return code: OK but no data was loaded */
  36.                                 /* Typically, other app started or forked */
  37.  
  38. /*
  39.  
  40. Default Addresses
  41.  
  42.    These control the home page selection. To mess with these for normal browses is asking
  43.    for user confusion.
  44.    
  45.  */
  46. #define LOGICAL_DEFAULT "WWW_HOME"  /* Defined to be the home page */
  47.  
  48. #ifndef PERSONAL_DEFAULT
  49. #define PERSONAL_DEFAULT "WWW/default.html"     /* in home directory */
  50. #endif
  51. #ifndef LOCAL_DEFAULT_FILE
  52. #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
  53. #endif
  54. /*  If one telnets to a www access point,
  55.     it will look in this file for home page */
  56. #ifndef REMOTE_POINTER
  57. #define REMOTE_POINTER  "/etc/www-remote.url"  /* can't be file */
  58. #endif
  59. /* and if that fails it will use this. */
  60. #ifndef REMOTE_ADDRESS
  61. #define REMOTE_ADDRESS  "http://info.cern.ch/remote.html"  /* can't be file */
  62. #endif
  63.  
  64. /* If run from telnet daemon and no -l specified, use this file:
  65. */
  66. #ifndef DEFAULT_LOGFILE
  67. #define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
  68. #endif
  69.  
  70. /*      If the home page isn't found, use this file:
  71. */
  72. #ifndef LAST_RESORT
  73. #define LAST_RESORT     "http://info.cern.ch/default.html"
  74. #endif
  75.  
  76.  
  77. /*
  78.  
  79. Flags which may be set to control this module
  80.  
  81.  */
  82. extern int HTDiag;                      /* Flag: load source as plain text */
  83. extern char * HTClientHost;             /* Name or number of telnetting host */
  84. extern FILE * logfile;                  /* File to output one-liners to */
  85. extern BOOL HTSecure;                   /* Disable security holes? */
  86. extern HTStream* HTOutputStream;        /* For non-interactive, set this */
  87. extern HTFormat HTOutputFormat;         /* To convert on load, set this */
  88.  
  89.  
  90.  
  91. /*
  92.  
  93. Load a document from relative name
  94.  
  95.   ON ENTRY,
  96.   
  97.   relative_name           The relative address of the file to be accessed.
  98.                          
  99.   here                    The anchor of the object being searched
  100.                          
  101.   ON EXIT,
  102.   
  103.   returns    YES          Success in opening file
  104.                          
  105.   NO                      Failure
  106.                          
  107.  */
  108. extern  BOOL HTLoadRelative PARAMS((
  109.                 CONST char *            relative_name,
  110.                 HTParentAnchor *        here));
  111.  
  112.  
  113. /*
  114.  
  115. Load a document from absolute name
  116.  
  117.   ON ENTRY,
  118.   
  119.   addr                    The absolute address of the document to be accessed.
  120.                          
  121.   filter                  if YES, treat document as HTML
  122.                          
  123.  */
  124.  
  125. /*
  126.  
  127.   ON EXIT,
  128.   
  129.  */
  130.  
  131. /*
  132.  
  133.   returns YES             Success in opening document
  134.                          
  135.   NO                      Failure
  136.                          
  137.  */
  138. #ifdef __cplusplus
  139. extern "C"    {
  140. #endif
  141. extern BOOL HTLoadAbsolute PARAMS((CONST char * addr));
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146.  
  147. /*
  148.  
  149. Load a document from absolute name to a stream
  150.  
  151.   ON ENTRY,
  152.   
  153.   addr                    The absolute address of the document to be accessed.
  154.                          
  155.   filter                  if YES, treat document as HTML
  156.                          
  157.   ON EXIT,
  158.   
  159.   returns YES             Success in opening document
  160.                          
  161.   NO                      Failure
  162.                          
  163.    Note: This is equivalent to HTLoadDocument
  164.    
  165.  */
  166. extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter,
  167.                                 HTStream * sink));
  168.  
  169.  
  170. /*
  171.  
  172. Load if necessary, and select an anchor
  173.  
  174.   ON ENTRY,
  175.   
  176.   destination                The child or parenet anchor to be loaded.
  177.                          
  178.  */
  179.  
  180. /*
  181.  
  182.   ON EXIT,
  183.   
  184.  */
  185.  
  186. /*
  187.  
  188.   returns YES             Success
  189.                          
  190.   returns NO              Failure
  191.                          
  192.  */
  193.  
  194.  
  195.  
  196. extern BOOL HTLoadAnchor PARAMS((HTAnchor * destination));
  197.  
  198.  
  199. /*
  200.  
  201. Make a stream for Saving object back
  202.  
  203.   ON ENTRY,
  204.   
  205.   anchor                  is valid anchor which has previously beeing loaded
  206.                          
  207.   ON EXIT,
  208.   
  209.   returns                 0 if error else a stream to save the object to.
  210.                          
  211.  */
  212.  
  213.  
  214. extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
  215.  
  216.  
  217. /*
  218.  
  219. Search
  220.  
  221.    Performs a search on word given by the user. Adds the search words to the end of the
  222.    current address and attempts to open the new address.
  223.    
  224.   ON ENTRY,
  225.   
  226.   *keywords               space-separated keyword list or similar search list
  227.                          
  228.   here                    The anchor of the object being searched
  229.                          
  230.  */
  231. extern BOOL HTSearch PARAMS((CONST char * keywords, HTParentAnchor* here));
  232.  
  233.  
  234. /*
  235.  
  236. Search Given Indexname
  237.  
  238.    Performs a keyword search on word given by the user. Adds the keyword to  the end of
  239.    the current address and attempts to open the new address.
  240.    
  241.   ON ENTRY,
  242.   
  243.   *keywords               space-separated keyword list or similar search list
  244.                          
  245.   *indexname              is name of object search is to be done on.
  246.                          
  247.  */
  248. extern BOOL HTSearchAbsolute PARAMS((
  249.         CONST char *    keywords,
  250.         CONST char *    indexname));
  251.  
  252.  
  253. /*
  254.  
  255. Register an access method
  256.  
  257.  */
  258.  
  259. typedef struct _HTProtocol {
  260.         char * name;
  261.         
  262.         int (*load)PARAMS((
  263.                 CONST char *    full_address,
  264.                 HTParentAnchor * anchor,
  265.                 HTFormat        format_out,
  266.                 HTStream*       sink));
  267.                 
  268.         HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
  269.  
  270. } HTProtocol;
  271.  
  272. extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
  273.  
  274.  
  275. /*
  276.  
  277. Generate the anchor for the home page
  278.  
  279.  */
  280.  
  281. /*
  282.  
  283.    As it involves file access, this should only be done once when the program first runs.
  284.    This is a default algorithm -- browser don't HAVE to use this.
  285.    
  286.  */
  287. extern HTParentAnchor * HTHomeAnchor NOPARAMS;
  288.  
  289. #endif /* HTACCESS_H */
  290. /*
  291.  
  292.    end of HTAccess  */
  293.